subroutine symabc(iin, iout, popin, irrepabc)
use mod_iop 
use mod_t
implicit none
integer, intent(in) :: popin(8),irrepabc
real*8, intent(inout)::iin(*), iout(*)
if(prec==8.and.igpu==0) then 
  call symabc_d(iin,iout,popin, irrepabc)
elseif(prec==4.and.igpu==0) then 
  call symabc_s(iin,iout,popin, irrepabc)
elseif(prec==8.and.igpu==1) then 
  call symabc_dg(iin,iout,popin, irrepabc)
elseif(prec==4.and.igpu==1) then 
  call symabc_sg(iin,iout,popin, irrepabc)
endif
return
end
subroutine symabc_d(iin, iout, popin, irrepabc)
use mod_iop 
use mod_symm
use mod_orbit
use mod_size
use mod_ioff
use mod_t
implicit none
integer, intent(in) :: popin(8),irrepabc
real*8, intent(inout)::iin(*), iout(*)
integer, external :: irpdso, isymoffso, idsymabc, isymoffabc
integer irrepa, irrepb, irrepc, irrepab, irrepbc, irrepca
integer idxabc, idxbc, idxcab, idxout, npop2(8)
integer ioffabc, ioffbca, ioffcab, ioffout, idxtest
integer irrep, numa, numb, numc, a, b, c, idxbca
integer numab, numbc, numca
! a<b<c = abc + bca + cab
do irrep = 1, nirrep 
   npop2(irrep) = irpdso(irrep, popin, popin, 1) 
enddo 
!
idxtest =0
do irrepc = 1, nirrep 
   irrepab = dirprd(irrepc, irrepabc) 
   numab = irpdso(irrepab, popin, popin, 1)
   do irrepb = 1, nirrep 
      irrepa = dirprd(irrepb, irrepab)
      irrepbc = dirprd(irrepb, irrepc) 
      irrepca = dirprd(irrepc, irrepa)
      numbc = irpdso(irrepbc, popin, popin, 1)
      numca = irpdso(irrepca, popin, popin, 1)
      numa = popin(irrepa)
      numb = popin(irrepb)
      numc = popin(irrepc) 
      ioffabc = isymoffso(irrepc, irrepabc, npop2, popin, 1) - 1 &
              + isymoffso(irrepb, irrepab, popin, popin, 1) - 1  
      ioffbca = isymoffso(irrepa, irrepabc, npop2, popin, 1) - 1 &
              + isymoffso(irrepc, irrepbc, popin, popin, 1) - 1  
      ioffcab = isymoffso(irrepb, irrepabc, npop2, popin, 1) - 1 &
              + isymoffso(irrepa, irrepca, popin, popin, 1) - 1
!      write(6,*)'irrepabc', irrepabc 
      ioffout = isymoffabc(irrepa, irrepb, irrepc, irrepabc, popin) - 1 
!      write(6,'(A, I4, I4, I4, I4)')'ioffout---', ioffout, irrepa, irrepb, irrepc
      if(irrepa>irrepb.or.irrepb>irrepc.or.irrepa>irrepc) cycle
      if(irrepa==irrepb.and.irrepb==irrepc) then 
!$omp parallel do
          do c = 3, numc 
          do b = 2, c-1
          do a = 1, b-1 
             idxabc = ioffabc + (c-1)*numab + (b-1)*numa + a 
             idxbca = ioffbca + (a-1)*numbc + (c-1)*numb + b 
             idxcab = ioffcab + (b-1)*numca + (a-1)*numc + c
             idxout = ioffout + (c-1)*(c-2)*(c-3)/6 + (b-1)*(b-2)/2 + a
!             idxtest = idxtest + 1
!             write(6,*)'idxtest', idxtest, idxout
             iout(idxout) = iin(idxabc) + iin(idxbca) + iin(idxcab) 
          enddo
          enddo
          enddo 
!$omp end parallel do
!          write(6,'(A,i4,i4,i4,i4)')'idxtest', idxtest, irrepa, irrepb, irrepc
      elseif(irrepa<irrepb.and.irrepb==irrepc) then 
!$omp parallel do
          do c = 2, numc 
          do b = 1, c-1
          do a = 1, numa 
             idxabc = ioffabc + (c-1)*numab + (b-1)*numa + a 
             idxbca = ioffbca + (a-1)*numbc + (c-1)*numb + b 
             idxcab = ioffcab + (b-1)*numca + (a-1)*numc + c
             idxout = ioffout + ((c-1)*(c-2)/2+b-1)*numa +  a
!             idxtest = idxtest + 1
!             write(6,*)'idxtest', idxtest, idxout
             iout(idxout) = iin(idxabc) + iin(idxbca) + iin(idxcab) 
          enddo
          enddo
          enddo 
!$omp end parallel do
!          write(6,'(A,i4,i4,i4,i4)')'idxtest', idxtest, irrepa, irrepb, irrepc
      elseif(irrepa==irrepb.and.irrepb<irrepc) then 
!$omp parallel do
          do c = 1, numc 
          do b = 2, numb
          do a = 1, b-1
             idxabc = ioffabc + (c-1)*numab + (b-1)*numa + a 
             idxbca = ioffbca + (a-1)*numbc + (c-1)*numb + b 
             idxcab = ioffcab + (b-1)*numca + (a-1)*numc + c
             idxout = ioffout + (c-1)*numb*(numb-1)/2+(b-2)*(b-1)/2 + a
!             idxtest = idxtest + 1
!             write(6,*)'idxtest', idxtest, idxout
             iout(idxout) = iin(idxabc) + iin(idxbca) + iin(idxcab) 
          enddo
          enddo
          enddo
!$omp end parallel do
!          write(6,'(A,i4,i4,i4,i4)')'idxtest', idxtest, irrepa, irrepb, irrepc
       elseif(irrepa<irrepb.and.irrepb<irrepc) then 
!$omp parallel do
          do c = 1, numc
          do b = 1, numb
          do a = 1, numa
             idxabc = ioffabc + (c-1)*numab + (b-1)*numa + a 
             idxbca = ioffbca + (a-1)*numbc + (c-1)*numb + b 
             idxcab = ioffcab + (b-1)*numca + (a-1)*numc + c
             idxout = ioffout + ((c-1)*numb+b-1)*numa + a
!             idxtest = idxtest + 1
!             write(6,*)'idxtest', idxtest, idxout
             iout(idxout) = iin(idxabc) + iin(idxbca) + iin(idxcab)
          enddo
          enddo
          enddo 
!$omp end parallel do
!          write(6,'(A,i4,i4,i4,i4)')'num    ', numa, numb, numc
!          write(6,'(A,i4,i4,i4,i4)')'idxtest', idxtest, irrepa, irrepb, irrepc
       endif
    enddo
enddo
!write(6,*)'idxtest', idxtest
return
end
subroutine symabc_s(iin, iout, popin, irrepabc)
use mod_iop 
use mod_symm
use mod_orbit
use mod_size
use mod_ioff
use mod_t
implicit none
integer, intent(in) :: popin(8),irrepabc
real*4, intent(inout)::iin(*), iout(*)
integer, external :: irpdso, isymoffso, idsymabc, isymoffabc
integer irrepa, irrepb, irrepc, irrepab, irrepbc, irrepca
integer idxabc, idxbc, idxcab, idxout, npop2(8)
integer ioffabc, ioffbca, ioffcab, ioffout, idxtest
integer irrep, numa, numb, numc, a, b, c, idxbca
integer numab, numbc, numca
! a<b<c = abc + bca + cab
do irrep = 1, nirrep 
   npop2(irrep) = irpdso(irrep, popin, popin, 1) 
enddo 
!
idxtest =0
do irrepc = 1, nirrep 
   irrepab = dirprd(irrepc, irrepabc) 
   numab = irpdso(irrepab, popin, popin, 1)
   do irrepb = 1, nirrep 
      irrepa = dirprd(irrepb, irrepab)
      irrepbc = dirprd(irrepb, irrepc) 
      irrepca = dirprd(irrepc, irrepa)
      numbc = irpdso(irrepbc, popin, popin, 1)
      numca = irpdso(irrepca, popin, popin, 1)
      numa = popin(irrepa)
      numb = popin(irrepb)
      numc = popin(irrepc) 
      ioffabc = isymoffso(irrepc, irrepabc, npop2, popin, 1) - 1 &
              + isymoffso(irrepb, irrepab, popin, popin, 1) - 1  
      ioffbca = isymoffso(irrepa, irrepabc, npop2, popin, 1) - 1 &
              + isymoffso(irrepc, irrepbc, popin, popin, 1) - 1  
      ioffcab = isymoffso(irrepb, irrepabc, npop2, popin, 1) - 1 &
              + isymoffso(irrepa, irrepca, popin, popin, 1) - 1
!      write(6,*)'irrepabc', irrepabc 
      ioffout = isymoffabc(irrepa, irrepb, irrepc, irrepabc, popin) - 1 
!      write(6,'(A, I4, I4, I4, I4)')'ioffout---', ioffout, irrepa, irrepb, irrepc
      if(irrepa>irrepb.or.irrepb>irrepc.or.irrepa>irrepc) cycle
      if(irrepa==irrepb.and.irrepb==irrepc) then 
!$omp parallel do
          do c = 3, numc 
          do b = 2, c-1
          do a = 1, b-1 
             idxabc = ioffabc + (c-1)*numab + (b-1)*numa + a 
             idxbca = ioffbca + (a-1)*numbc + (c-1)*numb + b 
             idxcab = ioffcab + (b-1)*numca + (a-1)*numc + c
             idxout = ioffout + (c-1)*(c-2)*(c-3)/6 + (b-1)*(b-2)/2 + a
!             idxtest = idxtest + 1
!             write(6,*)'idxtest', idxtest, idxout
             iout(idxout) = iin(idxabc) + iin(idxbca) + iin(idxcab) 
          enddo
          enddo
          enddo 
!$omp end parallel do
!          write(6,'(A,i4,i4,i4,i4)')'idxtest', idxtest, irrepa, irrepb, irrepc
      elseif(irrepa<irrepb.and.irrepb==irrepc) then 
!$omp parallel do
          do c = 2, numc 
          do b = 1, c-1
          do a = 1, numa 
             idxabc = ioffabc + (c-1)*numab + (b-1)*numa + a 
             idxbca = ioffbca + (a-1)*numbc + (c-1)*numb + b 
             idxcab = ioffcab + (b-1)*numca + (a-1)*numc + c
             idxout = ioffout + ((c-1)*(c-2)/2+b-1)*numa +  a
!             idxtest = idxtest + 1
!             write(6,*)'idxtest', idxtest, idxout
             iout(idxout) = iin(idxabc) + iin(idxbca) + iin(idxcab) 
          enddo
          enddo
          enddo 
!$omp end parallel do
!          write(6,'(A,i4,i4,i4,i4)')'idxtest', idxtest, irrepa, irrepb, irrepc
      elseif(irrepa==irrepb.and.irrepb<irrepc) then 
!$omp parallel do
          do c = 1, numc 
          do b = 2, numb
          do a = 1, b-1
             idxabc = ioffabc + (c-1)*numab + (b-1)*numa + a 
             idxbca = ioffbca + (a-1)*numbc + (c-1)*numb + b 
             idxcab = ioffcab + (b-1)*numca + (a-1)*numc + c
             idxout = ioffout + (c-1)*numb*(numb-1)/2+(b-2)*(b-1)/2 + a
!             idxtest = idxtest + 1
!             write(6,*)'idxtest', idxtest, idxout
             iout(idxout) = iin(idxabc) + iin(idxbca) + iin(idxcab) 
          enddo
          enddo
          enddo
!$omp end parallel do
!          write(6,'(A,i4,i4,i4,i4)')'idxtest', idxtest, irrepa, irrepb, irrepc
       elseif(irrepa<irrepb.and.irrepb<irrepc) then 
!$omp parallel do
          do c = 1, numc
          do b = 1, numb
          do a = 1, numa
             idxabc = ioffabc + (c-1)*numab + (b-1)*numa + a 
             idxbca = ioffbca + (a-1)*numbc + (c-1)*numb + b 
             idxcab = ioffcab + (b-1)*numca + (a-1)*numc + c
             idxout = ioffout + ((c-1)*numb+b-1)*numa + a
!             idxtest = idxtest + 1
!             write(6,*)'idxtest', idxtest, idxout
             iout(idxout) = iin(idxabc) + iin(idxbca) + iin(idxcab)
          enddo
          enddo
          enddo 
!$omp end parallel do
!          write(6,'(A,i4,i4,i4,i4)')'num    ', numa, numb, numc
!          write(6,'(A,i4,i4,i4,i4)')'idxtest', idxtest, irrepa, irrepb, irrepc
       endif
    enddo
enddo
!write(6,*)'idxtest', idxtest
return
end
subroutine symabc_dg(iin, iout, popin, irrepabc)
use mod_iop 
use mod_symm
use mod_orbit
use mod_size
use mod_ioff
use mod_t
implicit none
integer, intent(in) :: popin(8),irrepabc
real*8, intent(inout),device::iin(*), iout(*)
integer, external :: irpdso, isymoffso, idsymabc, isymoffabc
integer irrepa, irrepb, irrepc, irrepab, irrepbc, irrepca
integer idxabc, idxbc, idxcab, idxout, npop2(8)
integer ioffabc, ioffbca, ioffcab, ioffout, idxtest
integer irrep, numa, numb, numc, a, b, c, idxbca
integer numab, numbc, numca
! a<b<c = abc + bca + cab
do irrep = 1, nirrep 
   npop2(irrep) = irpdso(irrep, popin, popin, 1) 
enddo 
!
idxtest =0
do irrepc = 1, nirrep 
   irrepab = dirprd(irrepc, irrepabc) 
   numab = irpdso(irrepab, popin, popin, 1)
   do irrepb = 1, nirrep 
      irrepa = dirprd(irrepb, irrepab)
      irrepbc = dirprd(irrepb, irrepc) 
      irrepca = dirprd(irrepc, irrepa)
      numbc = irpdso(irrepbc, popin, popin, 1)
      numca = irpdso(irrepca, popin, popin, 1)
      numa = popin(irrepa)
      numb = popin(irrepb)
      numc = popin(irrepc) 
      ioffabc = isymoffso(irrepc, irrepabc, npop2, popin, 1) - 1 &
              + isymoffso(irrepb, irrepab, popin, popin, 1) - 1  
      ioffbca = isymoffso(irrepa, irrepabc, npop2, popin, 1) - 1 &
              + isymoffso(irrepc, irrepbc, popin, popin, 1) - 1  
      ioffcab = isymoffso(irrepb, irrepabc, npop2, popin, 1) - 1 &
              + isymoffso(irrepa, irrepca, popin, popin, 1) - 1
!      write(6,*)'irrepabc', irrepabc 
      ioffout = isymoffabc(irrepa, irrepb, irrepc, irrepabc, popin) - 1 
!      write(6,'(A, I4, I4, I4, I4)')'ioffout---', ioffout, irrepa, irrepb, irrepc
      if(irrepa>irrepb.or.irrepb>irrepc.or.irrepa>irrepc) cycle
      if(irrepa==irrepb.and.irrepb==irrepc) then 
!$acc kernels
!$acc loop independent
          do c = 3, numc 
!$acc loop independent
          do b = 2, c-1
!$acc loop independent
          do a = 1, b-1 
             idxabc = ioffabc + (c-1)*numab + (b-1)*numa + a 
             idxbca = ioffbca + (a-1)*numbc + (c-1)*numb + b 
             idxcab = ioffcab + (b-1)*numca + (a-1)*numc + c
             idxout = ioffout + (c-1)*(c-2)*(c-3)/6 + (b-1)*(b-2)/2 + a
!             idxtest = idxtest + 1
!             write(6,*)'idxtest', idxtest, idxout
             iout(idxout) = iin(idxabc) + iin(idxbca) + iin(idxcab) 
          enddo
          enddo
          enddo 
!$acc end kernels
!          write(6,'(A,i4,i4,i4,i4)')'idxtest', idxtest, irrepa, irrepb, irrepc
      elseif(irrepa<irrepb.and.irrepb==irrepc) then 
!$acc kernels
!$acc loop independent
          do c = 2, numc 
!$acc loop independent
          do b = 1, c-1
!$acc loop independent
          do a = 1, numa 
             idxabc = ioffabc + (c-1)*numab + (b-1)*numa + a 
             idxbca = ioffbca + (a-1)*numbc + (c-1)*numb + b 
             idxcab = ioffcab + (b-1)*numca + (a-1)*numc + c
             idxout = ioffout + ((c-1)*(c-2)/2+b-1)*numa +  a
!             idxtest = idxtest + 1
!             write(6,*)'idxtest', idxtest, idxout
             iout(idxout) = iin(idxabc) + iin(idxbca) + iin(idxcab) 
          enddo
          enddo
          enddo 
!$acc end kernels
!          write(6,'(A,i4,i4,i4,i4)')'idxtest', idxtest, irrepa, irrepb, irrepc
      elseif(irrepa==irrepb.and.irrepb<irrepc) then 
!$acc kernels
!$acc loop independent
          do c = 1, numc 
!$acc loop independent
          do b = 2, numb
!$acc loop independent
          do a = 1, b-1
             idxabc = ioffabc + (c-1)*numab + (b-1)*numa + a 
             idxbca = ioffbca + (a-1)*numbc + (c-1)*numb + b 
             idxcab = ioffcab + (b-1)*numca + (a-1)*numc + c
             idxout = ioffout + (c-1)*numb*(numb-1)/2+(b-2)*(b-1)/2 + a
!             idxtest = idxtest + 1
!             write(6,*)'idxtest', idxtest, idxout
             iout(idxout) = iin(idxabc) + iin(idxbca) + iin(idxcab) 
          enddo
          enddo
          enddo
!$acc end kernels
!          write(6,'(A,i4,i4,i4,i4)')'idxtest', idxtest, irrepa, irrepb, irrepc
       elseif(irrepa<irrepb.and.irrepb<irrepc) then 
!$acc kernels
!$acc loop independent
          do c = 1, numc
!$acc loop independent
          do b = 1, numb
!$acc loop independent
          do a = 1, numa
             idxabc = ioffabc + (c-1)*numab + (b-1)*numa + a 
             idxbca = ioffbca + (a-1)*numbc + (c-1)*numb + b 
             idxcab = ioffcab + (b-1)*numca + (a-1)*numc + c
             idxout = ioffout + ((c-1)*numb+b-1)*numa + a
!             idxtest = idxtest + 1
!             write(6,*)'idxtest', idxtest, idxout
             iout(idxout) = iin(idxabc) + iin(idxbca) + iin(idxcab)
          enddo
          enddo
          enddo 
!$acc end kernels
!          write(6,'(A,i4,i4,i4,i4)')'num    ', numa, numb, numc
!          write(6,'(A,i4,i4,i4,i4)')'idxtest', idxtest, irrepa, irrepb, irrepc
       endif
    enddo
enddo
!write(6,*)'idxtest', idxtest
return
end
subroutine symabc_sg(iin, iout, popin, irrepabc)
use mod_iop 
use mod_symm
use mod_orbit
use mod_size
use mod_ioff
use mod_t
implicit none
integer, intent(in) :: popin(8),irrepabc
real*4, intent(inout),device::iin(*), iout(*)
integer, external :: irpdso, isymoffso, idsymabc, isymoffabc
integer irrepa, irrepb, irrepc, irrepab, irrepbc, irrepca
integer idxabc, idxbc, idxcab, idxout, npop2(8)
integer ioffabc, ioffbca, ioffcab, ioffout, idxtest
integer irrep, numa, numb, numc, a, b, c, idxbca
integer numab, numbc, numca
! a<b<c = abc + bca + cab
do irrep = 1, nirrep 
   npop2(irrep) = irpdso(irrep, popin, popin, 1) 
enddo 
!
idxtest =0
do irrepc = 1, nirrep 
   irrepab = dirprd(irrepc, irrepabc) 
   numab = irpdso(irrepab, popin, popin, 1)
   do irrepb = 1, nirrep 
      irrepa = dirprd(irrepb, irrepab)
      irrepbc = dirprd(irrepb, irrepc) 
      irrepca = dirprd(irrepc, irrepa)
      numbc = irpdso(irrepbc, popin, popin, 1)
      numca = irpdso(irrepca, popin, popin, 1)
      numa = popin(irrepa)
      numb = popin(irrepb)
      numc = popin(irrepc) 
      ioffabc = isymoffso(irrepc, irrepabc, npop2, popin, 1) - 1 &
              + isymoffso(irrepb, irrepab, popin, popin, 1) - 1  
      ioffbca = isymoffso(irrepa, irrepabc, npop2, popin, 1) - 1 &
              + isymoffso(irrepc, irrepbc, popin, popin, 1) - 1  
      ioffcab = isymoffso(irrepb, irrepabc, npop2, popin, 1) - 1 &
              + isymoffso(irrepa, irrepca, popin, popin, 1) - 1
!      write(6,*)'irrepabc', irrepabc 
      ioffout = isymoffabc(irrepa, irrepb, irrepc, irrepabc, popin) - 1 
!      write(6,'(A, I4, I4, I4, I4)')'ioffout---', ioffout, irrepa, irrepb, irrepc
      if(irrepa>irrepb.or.irrepb>irrepc.or.irrepa>irrepc) cycle
      if(irrepa==irrepb.and.irrepb==irrepc) then 
!$acc kernels
!$acc loop independent
          do c = 3, numc 
!$acc loop independent
          do b = 2, c-1
!$acc loop independent
          do a = 1, b-1 
             idxabc = ioffabc + (c-1)*numab + (b-1)*numa + a 
             idxbca = ioffbca + (a-1)*numbc + (c-1)*numb + b 
             idxcab = ioffcab + (b-1)*numca + (a-1)*numc + c
             idxout = ioffout + (c-1)*(c-2)*(c-3)/6 + (b-1)*(b-2)/2 + a
!             idxtest = idxtest + 1
!             write(6,*)'idxtest', idxtest, idxout
             iout(idxout) = iin(idxabc) + iin(idxbca) + iin(idxcab) 
          enddo
          enddo
          enddo 
!$acc end kernels
!          write(6,'(A,i4,i4,i4,i4)')'idxtest', idxtest, irrepa, irrepb, irrepc
      elseif(irrepa<irrepb.and.irrepb==irrepc) then 
!$acc kernels
!$acc loop independent
          do c = 2, numc 
!$acc loop independent
          do b = 1, c-1
!$acc loop independent
          do a = 1, numa 
             idxabc = ioffabc + (c-1)*numab + (b-1)*numa + a 
             idxbca = ioffbca + (a-1)*numbc + (c-1)*numb + b 
             idxcab = ioffcab + (b-1)*numca + (a-1)*numc + c
             idxout = ioffout + ((c-1)*(c-2)/2+b-1)*numa +  a
!             idxtest = idxtest + 1
!             write(6,*)'idxtest', idxtest, idxout
             iout(idxout) = iin(idxabc) + iin(idxbca) + iin(idxcab) 
          enddo
          enddo
          enddo 
!$acc end kernels
!          write(6,'(A,i4,i4,i4,i4)')'idxtest', idxtest, irrepa, irrepb, irrepc
      elseif(irrepa==irrepb.and.irrepb<irrepc) then 
!$acc kernels
!$acc loop independent
          do c = 1, numc 
!$acc loop independent
          do b = 2, numb
!$acc loop independent
          do a = 1, b-1
             idxabc = ioffabc + (c-1)*numab + (b-1)*numa + a 
             idxbca = ioffbca + (a-1)*numbc + (c-1)*numb + b 
             idxcab = ioffcab + (b-1)*numca + (a-1)*numc + c
             idxout = ioffout + (c-1)*numb*(numb-1)/2+(b-2)*(b-1)/2 + a
!             idxtest = idxtest + 1
!             write(6,*)'idxtest', idxtest, idxout
             iout(idxout) = iin(idxabc) + iin(idxbca) + iin(idxcab) 
          enddo
          enddo
          enddo
!$acc end kernels
!          write(6,'(A,i4,i4,i4,i4)')'idxtest', idxtest, irrepa, irrepb, irrepc
       elseif(irrepa<irrepb.and.irrepb<irrepc) then 
!$acc kernels
!$acc loop independent
          do c = 1, numc
!$acc loop independent
          do b = 1, numb
!$acc loop independent
          do a = 1, numa
             idxabc = ioffabc + (c-1)*numab + (b-1)*numa + a 
             idxbca = ioffbca + (a-1)*numbc + (c-1)*numb + b 
             idxcab = ioffcab + (b-1)*numca + (a-1)*numc + c
             idxout = ioffout + ((c-1)*numb+b-1)*numa + a
!             idxtest = idxtest + 1
!             write(6,*)'idxtest', idxtest, idxout
             iout(idxout) = iin(idxabc) + iin(idxbca) + iin(idxcab)
          enddo
          enddo
          enddo 
!$acc end kernels
!          write(6,'(A,i4,i4,i4,i4)')'num    ', numa, numb, numc
!          write(6,'(A,i4,i4,i4,i4)')'idxtest', idxtest, irrepa, irrepb, irrepc
       endif
    enddo
enddo
!write(6,*)'idxtest', idxtest
return
end
